package com.cskaoyan.bean.promotion;

import com.cskaoyan.util.DateUtils;

import java.util.Date;

public class Poster {
    private Integer id;

    private String name;

    private String link;

    private String url;

    private Integer position;

    private String content;

    private Date startTime;

    private Date endTime;

    private Boolean enabled;

    private Date addTime;

    private Date updateTime;

    private Boolean deleted;

    public Poster() {
    }

    public Poster(CreatePosterBO posterBO) {
        this.content = posterBO.getContent();
        this.enabled = posterBO.getEnabled();
        this.link = posterBO.getLink();

        this.url = posterBO.getUrl();
        this.position = posterBO.getPosition();
        this.name = posterBO.getName();
        Date time = new Date();
        this.addTime = time;
        this.updateTime = time;
        this.deleted = false;
    }

    public Poster(UpdatePoster poster) {
        this.addTime = DateUtils.parseDate(poster.getAddTime());
        this.content = poster.getContent();
        this.deleted = poster.getDeleted();
        this.enabled = poster.getEnabled();
        this.id = poster.getId();
        this.link = poster.getLink();
        this.name = poster.getName();
        this.position = poster.getPosition();
        this.updateTime = DateUtils.parseDate(poster.getUpdateTime());
        this.url = poster.getUrl();
    }

    public Poster(DeletePosterBO posterBO) {
        this.addTime = DateUtils.parseDate(posterBO.getAddTime());
        this.content = posterBO.getContent();
        this.deleted = true;
        this.enabled = posterBO.getEnabled();
        this.id = posterBO.getId();
        this.link = posterBO.getLink();
        this.name = posterBO.getName();
        this.position = posterBO.getPosition();
        this.updateTime = new Date();
        this.url = posterBO.getUrl();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link == null ? null : link.trim();
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url == null ? null : url.trim();
    }

    public Integer getPosition() {
        return position;
    }

    public void setPosition(Integer position) {
        this.position = position;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content == null ? null : content.trim();
    }

    public Date getStartTime() {
        return startTime;
    }

    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }

    public Date getAddTime() {
        return addTime;
    }

    public void setAddTime(Date addTime) {
        this.addTime = addTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }
}